<template>
    <div class="ws-video-upload">
      <el-upload
        ref="upload"
        class="upload-demo"
        multiple
        :action="uploadUrl"
        :file-list="fileList"
        :data="params"
        :auto-upload="false">
        <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
        <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
      </el-upload>
    </div>
</template>

<script>
import Vue from 'vue'
import { Upload } from 'element-ui'
import baseUrl from '@/api/baseUrl'

Vue.use(Upload)

export default {
  name: 'WsVideoUpload',
  data () {
    return {
      uploadUrl: baseUrl + '/videos/upload',
      fileList: [],
      params: {
        path: 'Videos'
      }
    }
  },
  methods: {
    submitUpload () {
      this.$refs.upload.submit()
    }
  }
}
</script>

<style scoped>
.ws-video-upload {
  width: 100%;
  height: 100%;
  padding: 5px;
  background-color: rgb(31, 31, 31);
}
</style>
